<template>
  <div class="login-container">
    <div>
      <video id="bg-video" autoplay loop muted>
        <source src="@/assets/video.3cf57b17.mp4" type="video/mp4">
      </video>
    </div>
    <div class="box">
      <el-form class="login-form" auto-complete="on" label-position="left">
        <div class="title-container">
          <img
            src="https://fe-slwl-manager.itheima.net/static/img/logo1.33ef7fa0.png"
            alt=""
            class="logo"
          >
        </div>
        <el-form :model="loginFall" :rules="loginRules">
          <el-form-item prop="username">
            <el-input v-model="loginFall.username" placeholder="账号" />
            <img src="../../icons/svg/dashboard.svg" alt="" class="icon">
          </el-form-item>
          <el-form-item prop="password">
            <el-input v-model="loginFall.password" placeholder="密码" show-password />
            <img src="../../icons/svg/dashboard.svg" alt="" class="icon">
          </el-form-item>
          <el-form-item prop="captcha">
            <el-input v-model="loginFall.captcha" placeholder="验证码" />
            <img src="../../icons/svg/dashboard.svg" alt="" class="icon">
            <img src="../../icons/logo1.33ef7fa0.png" alt="" class="captcha">
          </el-form-item>
          <el-form-item>
            <el-button style="width: 100%" type="primary">登录</el-button>
          </el-form-item>
          <div class="text">
            仅用于IT培训教学使用，为保障您的个人信息安全，
            请勿向平台录入任何个人敏感信息 (如手机号、身份证号等)!
          </div>
        </el-form>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Login',
  data() {
    return {
      loginFall: {
        username: '',
        password: '',
        captcha: ''
      },
      loginRules: {
        username: [{ message: '账号不能为空', required: true, trigger: 'blur' }],
        password: [{ message: '密码不能为空', required: true, trigger: 'blur' }],
        captcha: [{ message: '不能为空', required: true, trigger: 'blur' }]
      }
    }
  }
}
</script>

<style lang="scss">
/* 修复input 背景不协调 和光标变色 */
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */

$bg: #283443;
$light_gray: #fff;
$cursor: #fff;

@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
  .login-container .el-input input {
    color: $cursor;
  }
}

/* reset element-ui css */
.login-container {
  position: relative;
  text-align: center;
  .el-input {
    display: inline-block;
    height: 47px;
    width: 100%;

    input {
      background: white;
      border: 2px #e15536 solid;

      -webkit-appearance: none;
      border-radius: 5px;

      color: black;
      height: 47px;
      caret-color: $cursor;

      &:-webkit-autofill {
        box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-text-fill-color: $cursor !important;
      }
    }
  }

  .el-form-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    color: #454545;
  }
}
</style>

<style lang="scss" scoped>
$bg: #2d3a4b;
$dark_gray: #889aa4;
$light_gray: #eee;

.login-container {
  min-height: 100%;
  width: 100%;

  overflow: hidden;

  .login-form {
    position: relative;
    width: 520px;
    max-width: 100%;
    padding: 20px 35px 0;
    margin: 0 auto;
    overflow: hidden;
  }

  .tips {
    font-size: 14px;
    color: #fff;
    margin-bottom: 10px;

    span {
      &:first-of-type {
        margin-right: 16px;
      }
    }
  }

  .svg-container {
    padding: 6px 5px 6px 15px;
    color: $dark_gray;
    vertical-align: middle;
    width: 30px;
    display: inline-block;

  }

  .title-container {
    position: relative;

    .title {
      font-size: 26px;
      color: $light_gray;
      margin: 0px auto 40px auto;
      text-align: center;
      font-weight: bold;
    }
  }

  .show-pwd {
    position: absolute;
    right: 10px;
    top: 7px;
    font-size: 16px;
    color: $dark_gray;
    cursor: pointer;
    user-select: none;
  }
}
.box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: #fffefe;
  width: 450px;
  height: 525px;
  padding: 36px 40px;
  border-radius: 10px;
}
.text {
  font-size: 14px;
  color: #e15536;
}
.el-button--primary {
  color: #fff;
  background-color: #e15536;
  border-color: #409eff;
}
.logo {
  width: 195px;
  height: 54px;
}
.videoContainer {
  position: fixed;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -100;
}

.videoContainer:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
  z-index: -1;
  top: 0;
  left: 0;
  background: rgba(25, 29, 34, 0.65);
}
#bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  opacity: 10;
}
.icon {
  height: 21px;
  width: 21px;
  position: absolute;
  left: 14px;
  top: 13px;
}
.ipt{
    padding: 0 30px;
}
.captcha{
    display: inline-block;
    vertical-align: top;
    width: 71px;
    height: 32px;
    cursor: pointer;
    margin-left: 10px;
    position: absolute;
    right: 10px;
    top: 9px;
}
</style>
